home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1996-01-17 | 3.2 KB | 117 lines |
- ' ************************************* Commands used:
- ' * * Vec Rot Pos Turbo Draw
- ' * Amcaf Examples * Vec Rot Angles Blitter Clear
- ' * Vector Rotate Wire + Glenz V1.0 * Vec Rot Precalc =Qsin
- ' * Written by Chris Hodges * =Vec Rot X
- ' * * =Vec Rot Y
- ' ************************************* =Vec Rot Z
- '
- ' Hide mouse.
- Hide
- ' Setup a nice little screen with double buffering
- Screen Open 0,320,256,8,Lowres
- Curs Off : Flash Off : Paper 0 : Pen 1 : Cls
- ' Special palette! When two lines overlap, they get a brighter colour!
- ' %001,%010,%011,%100,%101,%110,%111
- Palette 0,$444,$444,$AAA,$444,$AAA,$AAA,$FFF
- Double Buffer
- Autoback 0
- ' Read out, how many coords are used.
- Restore COORDS
- Read NUMCO
- ' Dim one field to keep these coords, and a second for the rotated.
- Dim CO(NUMCO,2),RC(NUMCO,1)
- ' Now read all coords in.
- For A=1 To NUMCO
- Read CO(A,0),CO(A,1),CO(A,2)
- Next
- ' Then, get the number of lines the object consists of.
- Restore LINES
- Read NUMLI
- ' Dim a field to hold the startcoord and the endcoord.
- Dim LI(NUMLI,1)
- ' Get the datas.
- For A=1 To NUMLI
- Read LI(A,0),LI(A,1)
- Next
- ' Set the three angles. Remember that these are non standard angles,
- ' one full rotation is at 1024, not 360!
- AX=0 : AY=512 : AZ=128
- ' New: BP contains the bitplane, onto which the Cube should be drawn.
- BP=0
- Repeat
- ' Start clearing the plane to be drawn on.
- Extension_8_121C 0,BP
- ' While the blitter is working, use the time to calculate the rotations.
- ' Move and set the angles.
- Add AX,10
- Add AY,8
- Add AZ,11
- Extension_8_1138 AX,AY,AZ
- ' Calculate the distances by using a sine-function and the three angles.
- POSX= Extension_8_1106(AX,300)
- POSY= Extension_8_1106(AY,300)
- POSZ= Extension_8_1106(AZ,500)+1500
- ' Set the camera positions.
- Extension_8_1122 POSX,POSY,POSZ
- ' Now it's time to compute the matrix.
- Extension_8_1152
- ' So let's rotate all coordinates of the field CO()
- For A=1 To NUMCO
- ' Note: You only have to use the vec rot function with parameters once.
- RC(A,0)= Extension_8_1168(CO(A,0),CO(A,1),CO(A,2))+160
- RC(A,1)= Extension_8_1184 +128
- Next
- ' It's time to finally get the lines to the screen!
- For A=1 To NUMLI
- ' Starting coordinates pair.
- C1=LI(A,0)
- ' Ending coordinates pair.
- C2=LI(A,1)
- ' Get the rotated coordinates
- X1=RC(C1,0) : Y1=RC(C1,1)
- X2=RC(C2,0) : Y2=RC(C2,1)
- ' Draw the line on bitplane BP.
- Extension_8_1016 X1,Y1 To X2,Y2, Extension_8_04F8(BP), Extension_8_04F8(BP)
- Next
- ' Swap the screens to bring the object to view.
- Screen Swap
- Wait Vbl
- ' Select next bitplane.
- Add BP,1,0 To 2
- Until Inkey$=Chr$(27) or Mouse Key<>0
- Screen Close 0
- End
- ' 1_____2
- ' 5/____/|
- ' | | |6|
- ' |4|__|_|3
- ' |/___|/
- ' 8 7
- COORDS:
- Data 8
- ' CUBE
- Data -100,-100,-100
- Data 100,-100,-100
- Data 100,-100,100
- Data -100,-100,100
- Data -100,100,-100
- Data 100,100,-100
- Data 100,100,100
- Data -100,100,100
-
- LINES:
- Data 12
- ' CUBE
- Data 1,2
- Data 2,3
- Data 3,4
- Data 4,1
- Data 5,6
- Data 6,7
- Data 7,8
- Data 8,5
- Data 1,5
- Data 2,6
- Data 3,7
- Data 4,8